# -*- makefile -*- for the C-level run-time support for SBCL

# This software is part of the SBCL system. See the README file for
# more information.
#
# This software is derived from the CMU CL system, which was
# written at Carnegie Mellon University and released into the
# public domain. The software is in the public domain and is
# provided with absolutely no warranty. See the COPYING and CREDITS
# files for more information.

ASSEM_SRC = x86-64-assem.S
ARCH_SRC = x86-64-arch.c
OS_SRC = haiku-os.c x86-64-haiku-os.c

LINKFLAGS += -Wl,--export-dynamic
OS_LIBS += -lbe -lnetwork -lbsd

ifdef LISP_FEATURE_SB_THREAD
  OS_LIBS += -lpthread
endif

ifdef LISP_FEATURE_SB_CORE_COMPRESSION
  OS_LIBS += -lzstd
endif

CFLAGS += -Wunused-parameter -fno-omit-frame-pointer -momit-leaf-frame-pointer -gdwarf-2
# The installed compiler won't work with no-pie.
# The support ticket https://dev.haiku-os.org/ticket/12430 is closed,
# but it certainly looks like my default install succumbed to the same problem
# in the gcc specs file in the exact way as illustrated in the bug.
DISABLE_PIE=no

ifdef LISP_FEATURE_IMMOBILE_SPACE
  GC_SRC = fullcgc.c gencgc.c traceroot.c immobile-space.c
else
  GC_SRC = fullcgc.c gencgc.c traceroot.c
endif

ifdef LISP_FEATURE_SB_LINKABLE_RUNTIME
  LIBSBCL = sbcl.o
  USE_LIBSBCL = sbcl.o
endif
